//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Windows.Data;
using OpenLS.Core;

namespace OpenLS.Drawing.UI.Internals
{
    class PaperSizeToWidthConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return UnitConverter.ToInches(PaperSizeToSizeConverter.GetSize((PaperSize)value).Width);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotSupportedException();
        }
    }
    class UnitConverter
    {
        internal static string ToInches(double pixels)
        {
            return string.Format("{0:N2}''", (pixels / 96));
        }
    }
    class PaperSizeToHeightConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            PaperSize size = (PaperSize)value;
            return UnitConverter.ToInches(PaperSizeToSizeConverter.GetSize(size).Height);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotSupportedException();
        }
    }
}
